Skip to content

fix: dev_mode SimpleGuard skips agent-card.json, add client.guard property#72

Merged
beonde merged 2 commits into
mainfrom
fix/dx-audit-simpleguard
May 21, 2026
Merged

fix: dev_mode SimpleGuard skips agent-card.json, add client.guard property#72
beonde merged 2 commits into
mainfrom
fix/dx-audit-simpleguard

Conversation

@beonde
Copy link
Copy Markdown
Member

@beonde beonde commented May 21, 2026

DX Audit Fixes

Found during a hands-on DX walkthrough of the getting-started docs with real API calls.

Changes

1. dev_mode now takes priority over legacy agent-card.json (Bug #1 — Critical)

SimpleGuard(dev_mode=True) crashed with ConfigurationError: agent-card.json missing 'public_keys' when an A2A agent-card.json (from validate-a2a) existed in the working directory. The A2A agent card format doesn't have public_keys — that's a CapiscIO-specific field.

Fix: Reorder _resolve_identity() so dev_mode (Case 3) is checked before legacy agent-card.json loading (now Case 4). Also skip directory walking in _resolve_project_root() when dev_mode=True.

2. Add client.guard property on AgentIdentity (Bug #6)

CapiscIO.connect() returns an AgentIdentity with _guard as a private field. Users following docs had no public way to access the guard for signing. Added a @property guard that lazily creates a SimpleGuard if needed.

Breaking Changes

None. Both changes are additive or fix broken paths.

Testing

  • Verified SimpleGuard(dev_mode=True) works with agent-card.json present (was crashing)
  • Verified sign/verify round-trip in dev_mode
  • Verified client.guard returns SimpleGuard with correct agent_id
  • FastAPI integration test passes

…perty

- Reorder _resolve_identity() so dev_mode (Case 3) takes priority over
  legacy agent-card.json loading (now Case 4). An A2A agent-card.json
  without public_keys no longer crashes SimpleGuard in dev_mode.
- Skip directory walking in _resolve_project_root() when dev_mode=True
- Add guard @Property on AgentIdentity for CapiscIO.connect() result
Copilot AI review requested due to automatic review settings May 21, 2026 16:38
@github-actions
Copy link
Copy Markdown

✅ Documentation validation passed!

Unified docs will be deployed from capiscio-docs repo.

@github-actions
Copy link
Copy Markdown

✅ All checks passed! Ready for review.

@github-actions
Copy link
Copy Markdown

✅ Documentation validation passed!

Unified docs will be deployed from capiscio-docs repo.

@github-actions
Copy link
Copy Markdown

✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests.

@github-actions
Copy link
Copy Markdown

✅ All checks passed! Ready for review.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
capiscio_sdk/connect.py 33.33% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

@github-actions
Copy link
Copy Markdown

✅ SDK server contract tests passed (test_server_integration.py). Cross-product scenarios are validated in capiscio-e2e-tests.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses developer-experience issues in the SDK by ensuring SimpleGuard(dev_mode=True) is not disrupted by unrelated agent-card.json files, and by exposing a public guard accessor on AgentIdentity returned from CapiscIO.connect().

Changes:

  • Update SimpleGuard identity resolution so dev_mode=True takes priority over legacy agent-card.json loading, and avoid project-root directory walking in dev mode.
  • Add an AgentIdentity.guard property intended to provide access to a SimpleGuard instance for signing/verifying.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
capiscio_sdk/simple_guard.py Reorders identity resolution to prefer dev mode over legacy agent-card.json, and skips upward directory walking when dev_mode=True.
capiscio_sdk/connect.py Adds a guard property to AgentIdentity to lazily create/access a SimpleGuard instance.

Comment thread capiscio_sdk/simple_guard.py
Comment thread capiscio_sdk/simple_guard.py
Comment thread capiscio_sdk/connect.py
@beonde beonde merged commit 2249033 into main May 21, 2026
12 of 13 checks passed
@beonde beonde deleted the fix/dx-audit-simpleguard branch May 21, 2026 16:50
@beonde beonde restored the fix/dx-audit-simpleguard branch May 22, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants